package com.mxpio.erp.common.hr.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_HR_ATTENDANCE_RECORDER")
@Schema(description="员工每日打卡记录")
public class AttendanceRecorder extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @Generator
    @Column(name = "ID_", updatable = false)
    @Schema(description = "ID")
    private String id;

    @Column(name = "USERNAME_", length = 64)
    @Schema(description = "用户名")
    private String username;

    @Column(name = "NICKNAME_", length = 64)
    @Schema(description = "昵称")
    private String nickname;

    @Column(name = "DEPT_CODE_")
    @Schema(description = "所属部门")
    @Dict(dicCode="deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String deptCode;

    @Column(name = "DATE_")
    @Schema(description = "日期")
    private String date;

    @Column(name = "CHECK_IN_TIME_")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "上班打卡时间")
    private Date checkInTime;

    @Column(name = "CHECK_OFF_TIME_")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "下班打卡时间")
    private Date checkOffTime;

    @Column(name = "DATE_TYPE_")
    @Schema(description = "日期类型")//同工作日历 日历类型 计算工时使用
    @Dict(dicCode = "MB_ERP_HR_ATTENDANCE_CALENDAR_DATETYPE")//0工作日 1周末 2节假日
    private String dateType;

    @Column(name = "WORKING_HOURS_")
    @Schema(description = "工时时长")
    private BigDecimal workingHours;

    @Column(name = "ONE_POINT_FIVE_HOURS_")
    @Schema(description = "1.5倍时长")
    private BigDecimal onePointFiveHours;

    @Column(name = "DOUBLE_HOURS_")
    @Schema(description = "2倍时长")
    private BigDecimal doubleHours;

    @Column(name = "THRICE_HOURS_")
    @Schema(description = "3倍时长")
    private BigDecimal thriceHours;

    @Column(name = "DETAIL_MSG_")
    @Schema(description = "工时测算明细")//工时测算明细
    private String detailMsg;

    @Column(name = "ERROR_MSG_")
    @Schema(description = "工时测算异常信息")//工时计算异常信息
    private String errorMsg;

    @Column(name = "SHIFT_TYPE_")
    @Schema(description = "班次")
    @Dict(dicCode = "MB_ERP_HR_ATTENDANCE_SHIFT_TYPE")//0夜班 1白班
    private String shiftType;
}
